package com.findyou;

import com.findyou.dyn.ProxyFactory;
import com.findyou.statics.StaticProxyCalculator;

/**
 * @Title: UseAop
 * @Author 贾金博
 * @Package com.findyou
 * @Date 2024/2/7 10:24
 * @description:
 */
public class UseAop {
    public static void main(String[] args) {
        Calculator target = new CalculatorPureImpl(); // 房东 目标
        // 中介 代理
        Calculator proxy = new StaticProxyCalculator(target);

//        // 调用
//        int result = proxy.add(1, 1);
//        System.out.println(result);

        // jdk 代理
        ProxyFactory factory = new ProxyFactory(target);
        Calculator proxy1 = (Calculator) factory.getProxy();
        int add = proxy1.add(1, 1);
        System.out.println(add);
    }
}
